// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import './assets/scss/dskt-base.scss'
import '@/assets/scss/iconfont/iconfont.css';

/* vue插件 */
import {ToastPlugin, ConfirmPlugin,AlertPlugin,LoadingPlugin} from 'vux'
Vue.use(ToastPlugin, {
  position: 'middle',
  time:3000,
})
Vue.use(ConfirmPlugin)
Vue.use(AlertPlugin)
Vue.use(LoadingPlugin)

import { Flexbox, FlexboxItem,XButton,Icon,TransferDom } from 'vux'
import { Divider } from 'vux'
Vue.component('divider', Divider)
Vue.component('flexbox', Flexbox)
Vue.component('flexbox-item', FlexboxItem)
Vue.component('icon', Icon)
Vue.component('x-button', XButton)
Vue.directive('transfer-dom', TransferDom)
//校验相关
import VeeValidate,{ Validator } from 'vee-validate'
import zh_CN from 'vee-validate/dist/locale/zh_CN'
const veeconfig = {
  errorBagName: 'veeerrors', 
  fieldsBagName: 'veefields',
};
Vue.use(VeeValidate,veeconfig);
//Validator.addLocale(zh_CN)
VeeValidate.Validator.localize('zh_CN');
//end  校验

//滚动插件
import VueScroller from 'vue-scroller'
Vue.use(VueScroller);
//end  滚动插件

//过滤器
import filters from "@/config/filters";
Vue.use(filters);
//end 过滤器
import 'url-search-params-polyfill';
//自定义js
import axios from './config/http'
import cookie from './assets/js/cookie'
import dbUtil from './assets/js/dbUtil'
import commonUtil from './assets/js/commonUtil'
Vue.prototype.$http = axios
Vue.prototype.$cookie = cookie
Vue.prototype.$dbUtil = dbUtil
Vue.prototype.$commonUtil = commonUtil
//自定义js


Vue.prototype.jSCallPhone = function (e,phones){//changeData是函数名
  var phone = phones
  if(!phones){
      var dom = e.srcElement;
      phone = $(dom).html().trim();
  }
  let isIos = !!navigator.userAgent.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
  if (isIos) {
    let a = document.createElement('a');
    a.href = 'tel:' + phone;
    a.style.visibility = 'hidden';
    document.body.appendChild(a);
    a.click();
  } else {
    window.location.href = 'tel:' + phone;
  }
}

Vue.config.productionTip = false

/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  components: { App },
  template: '<App/>'
})
